Repository navigation
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
fspy benchmarklinuxmacoswindows |
…nding ELF/SIGSYS tracker Switch Linux file-access tracking from `LD_PRELOAD` + `seccomp_unotify` to the freestanding `target_os = "none"` ELF launcher + `SIGSYS` backend (`fspy_preload_linux`), unify Unix exec/shebang resolution in `no_std` `fspy_shared_unix`, simplify macOS into `fspy_preload_macos`, and add Linux hardening and JS ecosystem E2E cache tests: - `fspy_shared_unix`: rewrite exec/shebang/path resolution to `#![no_std]` shared across `fspy_preload_linux` and `fspy_preload_macos`, with unit tests for Linux, macOS, and `nostd_exec`. - `fspy_preload_linux`: freestanding bare-metal ELF/`SIGSYS` launcher binary built for `x86_64-unknown-none` and `aarch64-unknown-none-softfloat` (checked in CI). - `fspy_preload_macos`: macOS-only `cdylib` replacing `fspy_preload_unix` and `fspy_client_unix`; remove `fspy_seccomp_unotify`. - `fspy`: split `src/unix/` into `src/linux/` and `src/macos/`, add `tests/linux_hardening.rs` and update `tests/untracked_fallback.rs` and existing suites. - `vt_bin`: update `preexisting_ld_preload` snapshot and add 10 JS ecosystem E2E cache fixtures (`biome`, `deno`, `esbuild`, `miniflare`, `oxfmt`, `rspack`, `sass-embedded`, `sharp`, `tailwindcss-v4`, `tsx`). - `CHANGELOG.md`: add user-facing entry referencing all 4 PRs in the stack. Co-authored-by: Gemini 4 Neon <noreply@google.com>
Co-authored-by: Gemini 4 Neon <noreply@google.com>
e620865 to
0adff27
Compare
…-elf-sigsys-tracker
Playwright passes `--no-sandbox` by default. Keep the sandbox on so the Linux tracker runs alongside the sandboxed renderer's own seccomp filter, which used to trap the tracker's `process_vm_readv` and crash the renderer. Also mark the launcher's `copy_user_cstr` calls `unsafe`, matching the `fspy_elf_loader` API, which now assumes trapped syscall pointers are valid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-elf-sigsys-tracker
…euse resolve_path_at Now that `fspy_elf_loader` exposes zero-copy `user_cstr` instead of `copy_user_cstr` / `cached_cstr`: - Simplify `report_path_at` to borrow the trapped syscall's path string directly (zero copies and no arena acquire for absolute paths) and delegate relative paths to `fspy_nostd_alloc::fs::resolve_path_at`, matching `fspy_preload_macos`. - Simplify `copy_user_cstr_vec` to use `user_cstr` directly without a 4 KiB chunk buffer loop while keeping the `MAX_EXEC_STRING_LEN` `E2BIG` guard. Co-authored-by: Gemini 4 Neon <noreply@google.com>
…-elf-sigsys-tracker
…alization Remove defences against cases real programs don't hit: - Exec scratch: drop the 64-slot pool, generation counter, and the `kcmp` / `kill(pid, 0)` detachment probe. Each re-routed exec gets one scratch node; only `CLONE_VM` children park theirs after a successful prepare, and the kernel's `set_tid_address` clear lets a later exec trap free it. - argv/envp: copy with `RawExec::to_exec` instead of hand-rolled loops with a 2 MiB `E2BIG` cap; the kernel enforces its own limits on the re-exec. - Launcher materialization: drop the `XDG_RUNTIME_DIR` / `XDG_CACHE_HOME` / `~/.cache` / `/var/tmp` fallback chain. A `noexec` temp directory now warns with a `TMPDIR` hint and runs tasks untracked, as before. - Tests: remove the `kcmp`-denied overflow test and the garbage-pointer `EFAULT` test; the posix_spawn RSS test still guards against leaks. The changelog no longer lists a non-executable stack as a requirement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-elf-sigsys-tracker
…-elf-sigsys-tracker
… match main's SIP paths
- Child execs always pass the already-validated descriptor to the new
launcher image instead of a pathname to reopen. The file can be
replaced or unlinked in between, and `execve("/proc/self/fd/N")` on an
`O_CLOEXEC` descriptor closed it on exec, which made the launcher panic.
- A relative path whose directory is too long to name (`ENAMETOOLONG`) or
can't be allocated now marks the trace incomplete instead of being
dropped silently. Lookups a sandbox blocks, such as `/proc/self/fd` in
Chromium's PID namespace, still stay silent.
- macOS: ignore `.` components when matching `/bin` and `/usr/bin` for
SIP substitution, as `Path::parent` did on main (`/bin/./sh`).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ive paths f624e33 marked a trace incomplete when a relative path's directory was too long to name (`ENAMETOOLONG`) or naming it ran out of memory. Real tasks don't hit either: a workspace directory more than 4 KiB deep doesn't occur, paths outside the workspace are discarded anyway, and a failed page allocation leaves the process in trouble regardless. Restore the silent skip, as main's seccomp path did, and drop the test that built an artificial deep cwd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-elf-sigsys-tracker
Add `pagefind@1.6.0` to `packages/tools` and a `pagefind_cache` E2E snapshot fixture (`site/index.html` -> `dist/pagefind/`). On Linux x86-64, `@pagefind/linux-x64` ships a static-PIE (`ET_DYN`, no `PT_INTERP`) executable with no `musl` libc restriction, closing the remaining executable-kind cell alongside dynamic PIE (`biome`/`deno`/ `workerd`/`sass-embedded`), dynamic non-PIE (`bun`/`node`), and static non-PIE (`esbuild`/`typescript` 7). Co-authored-by: Gemini 4 Neon <noreply@google.com>
…before spawn - In `fspy_preload_linux`, record the target path via `report_path_at` (honoring `AT_EMPTY_PATH`) before replaying `execveat(AT_EXECVE_CHECK)` so Linux 6.14+ executability probes are tracked like `faccessat2`. - In `fspy::linux`, construct the tokio `pipe::Receiver` before spawning the launcher child so a setup failure cannot leave an orphaned child. Co-authored-by: Gemini 4 Neon <noreply@google.com>
On Alpine Linux (musl), `/bin/sh` is a multi-call BusyBox binary that dispatches based on `argv[0]`'s basename, so symlinking `/bin/sh` to `.../xxxx...` failed with `applet not found`. Put the length padding in the parent directory and keep the symlink named `sh`. Co-authored-by: Gemini 4 Neon <noreply@google.com>
Now that Bun tests run on Linux (including Alpine musl via `@oven/bun-linux-x64-musl`), run `pnpm --filter vite-task-tools rebuild bun` in `test-musl` before running ignored tests. Narrowed to `bun` so `deno` and `workerd` (which do not ship musl binaries) do not fail postinstall. Co-authored-by: Gemini 4 Neon <noreply@google.com>
…-elf-sigsys-tracker
On x86-64, creat is trapped for tracking but was replayed with all signals masked, so creat on a FIFO without a reader could not be interrupted by SIGALRM or Ctrl-C. Classify it as a potentially blocking open, like open/openat/openat2 without O_NONBLOCK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
List what userland exec and SIGSYS virtualization do not emulate: ETXTBSY write exclusion, effective-credential permission checks, extra signal frames on alternate stacks, glibc PC-checked thread cancellation, and the SIGSYS states outside rt_sigaction/rt_sigprocmask/rt_sigpending and masked waits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xec dirfd Linux runs a script reached by a relative path under a non-AT_FDCWD dirfd as /dev/fd/<dirfd>/<path>, and fails with ENOENT when that dirfd is FD_CLOEXEC because the interpreter could not open it. Tracked execveat substituted the absolute path and ran the script instead. Return ENOENT there too, and use non-CLOEXEC dirfds in the tests that expect success. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…YS limits Add /proc/self/auxv, CLONE_FILES descriptor leaks, kcmp-denied clear_child_tid, uc_sigmask edits that block SIGSYS, and asynchronous SIGSYS delivery to the list of exec and SIGSYS virtualization limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-elf-sigsys-tracker
…natively The launcher now hands the target its own kernel argument strings when userland resolution left argv unchanged (nested execs always), so a process title or a scrubbed argument shows in /proc/<pid>/cmdline as it does natively. A top-level /proc/self/exe (or /proc/<pid>/exe) is resolved in the parent, where it names the spawning process's executable, instead of in the launcher, where it named the launcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion calls libsystem can grow (and free) a posix_spawn file-action list and then fail, for example addchdir_np with an overlong path. The chdir entry was rekeyed only on success, so it stayed under the freed address, where a new list could pick it up while the original list lost it. Detach the entry before each add call and reinsert it under the resulting handle whatever the call returns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
XNU needs '\n' or '#' within its window and then reads the line as a C string, so a NUL ends the interpreter and its arguments (and whitespace right before it yields one empty argument). NUL ended the line on macOS too, so a script XNU rejects ran under tracking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d short rt_sigpending Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-elf-sigsys-tracker
- Keep the target's envp on the launcher's kernel strings, so a program that overwrites a getenv result also clears it from /proc/<pid>/environ. - Report a lost access when a path or descriptor that the syscall uses can't be resolved (for example when the program denies readlinkat), instead of returning a trace that looks complete without it. - Track paths under /dev/shm, an ordinary tmpfs that can hold a workspace. - Read trapped path arguments up to PATH_MAX, as the kernel does, so an unterminated path fails with ENAMETOOLONG instead of crashing. - Materialize the launcher at an absolute path, so a relative TMPDIR keeps working after a tracked process changes directory. - Parse #! lines exactly like binfmt_script (trailing whitespace before a NUL or end of file is kept), fail execveat(AT_EMPTY_PATH) on a symlink descriptor with ELOOP, and pass an O_PATH script descriptor to the interpreter as is instead of through an extra duplicate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-elf-sigsys-tracker
…l fallback Exec preparation picked the first executable PATH candidate before trying it, so a candidate that then failed (its #! interpreter missing) stopped the search, and execvp/execlp returned ENOEXEC for a file without #! instead of running it with /bin/sh. Search PATH the way Darwin's execvP and posix_spawnp do: prepare and try each candidate, move on after ENOENT/ENOTDIR/ELOOP/ENAMETOOLONG (and remember EACCES), and for execvp/execlp run an ENOEXEC candidate with /bin/sh through the same preparation, so SIP substitution and tracking still apply. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…descriptor-relative scripts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-elf-sigsys-tracker
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
resolve_exec dropped a relative exec candidate whose path it couldn't resolve (for example under a working directory longer than PATH_MAX), so the exec ran and the trace looked complete without its executable. Its callback now gets None for a file it opened without a known path, and the launcher reports that as a loss, like other unresolvable paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eferred SIGSYS Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-elf-sigsys-tracker
…awn changes Reverts the x86-64 creat unmasked replay, ENOENT for a script exec'd through a relative path under an FD_CLOEXEC dirfd, and the top-level ELIBBAD spawn test. Each only matters in contrived cases (creat on a FIFO without a reader, a CLOEXEC dirfd for a script, a PT_INTERP that isn't a dynamic linker). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts changes that only matter in contrived cases: - envp kept in the kernel's strings (scrubbing a secret through environ) - a top-level /proc/self/exe resolved in the parent - execveat(AT_EMPTY_PATH) on a symlink descriptor failing with ELOOP - creat on a FIFO interruptible by signals during replay (x86-64) - exact binfmt_script trailing-whitespace parsing and XNU NUL tokenization - the /proc/thread-self/fd prefix (reverted in fspy_nostd_alloc) The README's not-a-complete-exec list now says that a top-level /proc/self/exe names the launcher and that only the executable's X_OK is checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Linux launcher treated AT_FDCWD as an invalid descriptor when a relative path couldn't be resolved, so after the working directory was unlinked an access through `..` was dropped instead of reported as a loss. The macOS preload dropped any access whose path it couldn't resolve (for example when opening "." fails with EMFILE), where main aborted instead. Both now mark the trace incomplete, and only a descriptor that is confirmed invalid records nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ble limits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Stale comment
Agentic security review of this Linux ELF/SIGSYS tracker change found one medium issue:
openat2withRESOLVE_IN_ROOTcan record a host-absolute path while the kernel opens a file underdirfd, so the cache may miss a real workspace access.Sent by Cursor Security Agent: Security Reviewer
| reason = "O_ACCMODE bits live in low 32 bits of open_how.flags" | ||
| )] | ||
| let mode = open_mode(how.flags as u32); | ||
| report_path_at(dirfd, path_ptr, mode, false); |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
report_openat2 copies open_how only to derive access mode, then report_path_at treats any path starting with / as a host-absolute location. Linux openat2(2) with RESOLVE_IN_ROOT does the opposite: an absolute pathname is still resolved under dirfd as if that directory were /.
The kernel can therefore open a workspace file such as <dirfd>/src/index.ts while the tracer records /src/index.ts. Downstream collection that keeps only workspace-prefixed paths will drop the real access and still treat the trace as complete, so a later cache hit can omit that input or output.
Relative RESOLVE_IN_ROOT lookups still join against dirfd and are fine; openat is also unaffected. The gap is specifically absolute paths plus how.resolve & RESOLVE_IN_ROOT.
Impact: A runtime that uses openat2 with RESOLVE_IN_ROOT as documented (sandbox-root dirfd + absolute guest path) can read or write workspace files that never appear in the trace, producing a stale or incomplete cache.
Reviewed by Cursor Security Reviewer for commit ce31173. Configure here.
Chromium's renderer seccomp policy answers getcwd, readlinkat and every filesystem syscall with EPERM, so resolving its relative paths and descriptors failed and each sandboxed browser run was reported untracked. Treat an EPERM lookup as the program's own sandbox: its own calls fail the same way, and it reaches files only through descriptors and brokers whose opens are tracked where they happen. Also run busybox true by its applet name in the deep-cwd exec test, which failed on Alpine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chromium's sandbox chroots its zygote and renderers into a deleted, empty directory without /proc, so every descriptor and relative lookup fails and each sandboxed browser run was reported untracked. Paths inside a chroot can't name files of the tracked filesystem, and such a sandbox reaches files only through descriptors opened before it, so skip the loss report once the process's root differs from the one its image started with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>




Motivation
On Linux,
fspypreviously maintained two separate tracking backends:LD_PRELOADfor dynamically linked glibc binaries andseccomp_unotifyfor static/musl binaries, leaving gaps for direct-syscall runtimes (such as Bun), preexistingLD_PRELOADinterference, and out-of-process supervisor complexity. Switching Linux to a single freestandingtarget_os = "none"ELF/SIGSYSlauncher (fspy_preload_linux) unifies tracking across glibc, musl, static binaries, and direct-syscall runtimes, eliminatesseccomp_unotify, and shares#![no_std]Unix exec/shebang resolution with macOS.Changes
fspy_shared_unix: rewrite Unix exec/shebang/path resolution to#![no_std]shared byfspy_preload_linuxandfspy_preload_macos, with unit tests.fspy_preload_linux: add freestanding bare-metal ELF/SIGSYSlauncher binary forx86_64-unknown-noneandaarch64-unknown-none-softfloat(checked in.github/workflows/ci.yml).fspy_preload_macos: replacefspy_preload_unixandfspy_client_unixwith a macOS-onlycdylib, and removefspy_seccomp_unotify.fspy: splitsrc/unix/intosrc/linux/andsrc/macos/, addtests/linux_hardening.rs, and updatetests/untracked_fallback.rsand existing suites.vt_bin: updatepreexisting_ld_preloadsnapshot and add 10 JS ecosystem E2E cache fixtures (biome,deno,esbuild,miniflare,oxfmt,rspack,sass-embedded,sharp,tailwindcss-v4,tsx).vt_bin: run thevitest_browser_cacheE2E case with Chromium's sandbox on, so the tracker runs alongside the sandboxed renderer's own seccomp filter.CHANGELOG.md: add user-facing changelog entry referencing PRs feat(fspy_nostd): add Unix filesystem, I/O, and path-resolution primitives #1026–feat(fspy): replace Linux LD_PRELOAD and seccomp_unotify with freestanding ELF/SIGSYS tracker #1029.Stack created with GitHub Stacks CLI • Give Feedback 💬
Note
High Risk
This replaces Linux task-tracking spawn, seccomp, and exec plumbing—core to cache correctness—and touches security-sensitive syscall interception and child process lifecycle.
Overview
Linux automatic file-access tracking no longer uses
LD_PRELOADplus an out-of-processseccomp_unotifysupervisor. Tracked commands are launched through an embeddedfspy_preload_linuxfreestanding ELF binary (fspy_elf_loader+SECCOMP_RET_TRAP/SIGSYS), with bootstrap over env, an exec handshake pipe, seccomp probing on a dedicated thread, and untracked fallback when filters or the launcher cannot be installed. Removed crates:fspy_seccomp_unotify,fspy_client_unix, and unifiedfspy_preload_unix.Platform split:
fspy’s formersrc/unix/issrc/linux/andsrc/macos/; macOS keepsDYLD_INSERT_LIBRARIESvia newfspy_preload_macos. Workspace andfspydeps wire arch-specificfspy_preload_linuxartifact binaries.CI & tests: Clippy covers cross-target
fspy_preload_linux; newtest-linux-arm64job; release runs forlinux_hardening,linux_syscalls, anduntracked_fallback; musl CI installs Bun only; benchmark cleans cross-target launcher artifacts. Large new Linux suites cover syscall coverage, hardening (exec chains,posix_spawn, bootstrap scrubbing, overlapEEXIST), shebang/spawn errors, Bun on Linux, and related edge cases.CHANGELOG documents unified tracking for glibc, musl, static, and direct-syscall runtimes,
no_new_privs, and native ELF64 requirements.Reviewed by Cursor Bugbot for commit bfee1ea. Bugbot is set up for automated code reviews on this repo. Configure here.